<template>
  <div class="home">
    <Swiper/>
    <div class="section" v-for="(item,index) in songsList" :key="index">
      <div class="section-title">{{item.name}}</div>
      <ContentList :contentList="item.list"></ContentList>
    </div>
  </div>
</template>

<script>
import Swiper from "@/components/Swiper";
import ContentList from "@/components/ContentList";

export default {
  name: 'Home',
  components: {
    Swiper,ContentList
  },
  data () {
    return {
      songsList:[
        {name:'歌单',list:[]},
        {name:'歌手',list:[]}
      ]
    }
  },
  methods: {
    async getAllSongLists(){
     let result= await this.$API.reqShowAllSongList()
      if (result.code==10000){
        this.songsList[0].list=result.data.slice(0,10)
      }
    },
    async getAllSingerLists(){
      let result= await this.$API.reqShowAllSinger()
      if (result.code==10000){
        this.songsList[1].list=result.data.slice(0,10)
      }
    }
  },
  mounted() {
    this.getAllSongLists()
    this.getAllSingerLists()
  }
}
</script>

<style lang="scss" scoped>
@import '../assets/css/home.scss';
</style>
